<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="template.xhtml">
	<ui:define name="content">
	
		<f:metadata>  
		    <f:viewParam name="elementId" value="#{airportBean.airportId}" />  
		</f:metadata>

		<h2>Modifica aeroporto "<h:outputText value="#{airportBean.airport.name}" />":</h2>

		<h:form>
			<p:panelGrid columns="2">
				<f:facet name="header">  
		        	Inserisci nuovo elemento 
		    	</f:facet>
		    	
		    	<h:outputLabel value="Nome:" />  
		    	<p:inputText value="#{airportBean.airport.name}"></p:inputText>
		    	
		    	<h:outputLabel value="Località:" /> 
		    	<p:selectOneMenu value="#{airportBean.airport.locationId}" effect="fold">  
		            <f:selectItems var="loc" value="#{locationBean.allLocations}" itemLabel="#{loc.name}" itemValue="#{loc.id}" />  
		            <p:column>  
		                #{loc.name}
		            </p:column> 
		        </p:selectOneMenu>
		        
		        <h:outputLabel value="Indirizzo:" />  
		    	<p:inputTextarea rows="3" value="#{airportBean.airport.address}"></p:inputTextarea>
		       
		    	
		    	<f:facet name="footer"> 
		    	
		    		<center>
		    			<p:button outcome="manageAirports" value="Annulla" />
		    			<p:commandButton action="#{airportBean.updateAirport}" value="Salva" />
		    		</center>
		    	
		    	</f:facet>
			
			</p:panelGrid>
			</h:form>
			<br />
			<p:messages showDetail="true" autoUpdate="true" closable="true" />

	</ui:define>
</ui:composition>
</html>